import type {
  BindDetailResp,
  BindListReq,
  BindListResp,
} from './model/bindModel';
import type { MyAgentListType } from './model/listModel';

import { type BaseListReq, type BaseListResp } from '#/api/model/baseModel';
import { requestClient } from '#/api/request';

enum AgentBind {
  GetAgentBindList = '/cs-api/agent_bind/list',
  GetAgentCustomerList = '/cs-api/agent_customer_list',
  GetMyAgentList = '/cs-api/my_agent_list',
  UpdateAgentBind = '/cs-api/agent_bind',
}

/**
 * @description: Get agentBind list
 */

export const getAgentBindList = (params: BaseListReq) => {
  return requestClient.get<BaseListResp<BindListResp>>(
    AgentBind.GetAgentBindList,
    {
      params,
    },
  );
};

/**
 * @description: Get agentCustomer list
 */

export const getAgentCustomerList = (params: BaseListReq) => {
  return requestClient.get(AgentBind.GetAgentCustomerList, {
    params,
  });
};

/**
 * @description: Get my agent list
 */

export const getMyAgentList = (params: BaseListReq) => {
  return requestClient.get<BaseListResp<MyAgentListType>>(
    AgentBind.GetMyAgentList,
    {
      params,
    },
  );
};

// /**
//  *  @description: Create a new customer
//  */
// export const createagent = (data: AgentReq) => {
//   return requestClient.post('/cs-api/agent', data);
// };

/**
 *  @description: Update the updateAgentBind
 */
export const updateAgentBind = (data: BindListReq) => {
  return requestClient.put(AgentBind.UpdateAgentBind, data);
};

// /**
//  *  @description: Delete customer
//  */
// export const deleteAgent = (id: number) => {
//   return requestClient.delete(`/cs-api/agent/${id}`);
// };

/**
 *  @description: Get customer By ID
 */
export const getAgentBindById = (id: number) => {
  return requestClient.get<BindDetailResp>(`/cs-api/agent_bind/${id}`);
};
